package com.mxx.tomcat.aspect;

import lombok.Data;
import lombok.experimental.Accessors;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;

/**
 * @Auther: Mr. Zeng
 * @Date: 2020/5/18 20:47
 * @Description: 暂无描述
 */
@Data
@Accessors(chain = true)
public class AspectEntry {
    private List<Class> superClassList;
    private List<Class> superInterfaceList;
    private List<Class<? extends Annotation>> annotationClassList;
    private List<Class<? extends Annotation>> allowAnnotation;
    private boolean blockAll;

    public AspectEntry() {
        blockAll = false;
        this.superClassList = new ArrayList<>();
        this.superInterfaceList = new ArrayList<>();
        this.annotationClassList = new ArrayList<>();
        this.allowAnnotation = new ArrayList<>();
    }

    public AspectEntry addAnnotationClass(Class<? extends Annotation> annotation) {
        this.annotationClassList.add(annotation);
        return this;
    }

    public AspectEntry addSuperClassList(Class superClass) {
        this.superClassList.add(superClass);
        return this;
    }

    public AspectEntry addSuperInterfaceList(Class superInterface) {
        this.superInterfaceList.add(superInterface);
        return this;
    }

    public AspectEntry blockAll() {
        this.blockAll = true;
        return this;
    }

    public AspectEntry addAllowAnnotation(Class<? extends Annotation> annotation) {
        this.allowAnnotation.add(annotation);
        return this;
    }
}
